﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using YakShaver.YakServer;
using YakShaver.TFSExtension;
using YakShaver.Contract;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace YakShaver.TFSExtension
{
	public class TFSAnalysisService : IAnalysisService
	{
        #region IAnalysisService Members

        public YakShaverWorkItem AnalyzeSubmittedWorkItem(ref IWorkItemDataContract workItemData)
        {

            // some test code to make us go green at first..  This will be stripped ina bout 20 mins

            YakShaverWorkItem workItem = new YakShaverWorkItem();
            workItem.Component = workItemData.PageId;
            workItem.Description = workItemData.Description;
            workItem.Title = workItemData.Title;
            workItem.WorkItemImpactType = workItemData.WorkItemImpactType;
            workItem.WorkItemType = workItemData.WorkItemType;

            switch (workItem.Component)
            {
                case "/home/test.aspx":
                    workItem.WorkItemImpactType = WorkItemImpactType.Unknown;
                    workItem.WorkItemType = YakShaver.Contract.WorkItemType.Unknown;
                    break;
                case "/home/test2.aspx":
                    workItem.WorkItemType = YakShaver.Contract.WorkItemType.Issue;
                    workItem.WorkItemImpactType = WorkItemImpactType.Medium;
                    workItem.Status = WorkItemSubmissionStatus.Ready;
                    break;
            }
           
            

            return workItem;
        }

        #endregion
    }
}
